<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>租金提醒沟通记录表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <c:if test="${cstId==null or cstId==''}">
        <div class="searchArea">
            <form id="searchBar">
                <div class="fieldset1 clearFix">
                    <div class="fieldBox">
                        <div class="label">客户名称</div>
                        <div class="field">
                            <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">所属机构</div>
                        <div class="field">
                            <input name="buOrgCd" id="buOrgCd" placeholder="请选择" ltype="combobox">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">提醒时间</div>
                        <div class="field">
                            <input ligerui="width: 82" name="startCollectTm" id="startCollectTm" type="text" class="ui-datepicker" value="" >
                            -
                            <input ligerui="width: 82" name="endCollectTm" id="endCollectTm" type="text" class="ui-datepicker" value="">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">任务人</div>
                        <div class="field">
                            <input name="collectUsrNm" id="collectUsrNm" type="text" class="ui-textbox" value="">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">提醒方式</div>
                        <div class="field">
                            <input name="collectWayCd" id="collectWayCd" placeholder="请选择" ltype="combobox">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">沟通状态</div>
                        <div class="field">
                            <input name="commStsCd" id="commStsCd" placeholder="请选择" ltype="combobox">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">证件号码</div>
                        <div class="field">
                            <input name="certNo" id="certNo" type="text" class="ui-textbox" value="">
                        </div>
                    </div>

                    <div class="formBtns notRight">
                        <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                        <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                        <%--<span id="expXlsBtn" class="sq-button sq-button-round">导出</span>--%>
                        <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                    </div>
                </div>
            </form>
        </div>
    </c:if>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null,form=null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/risk/rskCommRec/initList.do?buTypCd=${buTypCd}',
            method: 'get',
            columns: [
                {display: '客户名称', name: 'cstNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '所属机构', name: 'buOrgCdNm', width: 130, align: 'left', enabledSort: false},
                {display: '提醒时间', name: 'collectTm', width: 80, align: 'left', enabledSort: false,render:renderDate},
                {display: '外呼时长（秒）', name: 'commSec', width: 80, align: 'center', enabledSort: false},
                {display: '提醒方式', name: 'collectWayCdNm', width: 80, align: 'center', enabledSort: false},
                {display: '任务人', name: 'collectUsrNm', width: 80, align: 'left', enabledSort: false},
                {display: '联系人', name: 'lkMan', width: 70, align: 'left', enabledSort: false},
                {display: '联系电话', name: 'lkPhone', width: 90, align: 'center', enabledSort: false},
                {display: '证件号码', name: 'certNo', width: 120, align: 'center', enabledSort: false},
                {display: '贷前风险标记', name: 'preLoanRskInfo', width: 120, align: 'center', enabledSort: false},
                {display: '贷后风险核查', name: 'postLoanRskCdNm', width: 90, align: 'center', enabledSort: false},
                {display: '沟通记录', name: 'collectRem', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '<span class="gridTip" style="cursor: pointer;" title="'+ rowdata.collectRem +'">'+rowdata.collectRem+'</span>';
                    }
                }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
            enabledEdit: true,
        });
        grid.setHeight(100);

        //事业部
        $("#buOrgCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        //沟通方式
        $("#collectWayCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
      	//外呼沟通状态
        $("#commStsCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        form=$("#searchBar").ligerForm();
        liger.get("buOrgCd").setData(${buOrgCdList});
        liger.get("collectWayCd").setData(${collectWayCdList});
        liger.get("commStsCd").setData(${commStsCdList});

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });

        var callback = function () {
            grid.reload();
        };

        /* 导出 */
        $("#expXlsBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            var req="buTypCd=${buTypCd}";
            for (name in data) {
                for (name in data) {
                    if(data[name]){
                        req=req+"&"+name+"="+data[name];
                    }
                }
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType:'json',
                url: '<%=path%>/risk/rskCommRec/exportCommRecList.do?'+req,
                data:data,
                beforeSend:function(){
                    wait_dialog=$.ligerDialog.SQalert({content: '正在导出...',SQ_type: "waitting"});
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                        window.open(msg.data);
                    }else{
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    }
                }
            });
        });

    });

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
</script>

</body>
</html>
